<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
	<style>
		div{width: 200px;height: 200px;float: left;border: 1px solid black;margin: 10px}
	</style>
	<script>
		window.onload = function () {
			var aDiv = document.getElementsByTagName('div');
			for (var i = 0; i < aDiv.length; i++) {
				aDiv[i].style.background = 'red';
			}


//        aDiv[1].style.background='red';
//        aDiv[2].style.background='red';
//        aDiv[3].style.background='red';
//        aDiv[4].style.background='red';
		}

//		var colors = new Array();
//		colors.push('red');
//		colors.push('yellow');
//		colors.push('green');
//		colors.push('pink');
//		colors.push('green');


		var k = 5;
		function sendyzm() {
			k--;
			document.getElementById("yzm").disabled = true;   //让按钮禁用
			if(k==0) {
				document.getElementById("yzm").innerHTML="发送验证码";
				document.getElementById("yzm").disabled = false;//让按钮启用
				k = 5;
			}else{
				setTimeout("sendyzm()", 1000);
				document.getElementById("yzm").innerHTML=k+"秒后可重新获取验证码";
			}



		}

	</script>
</head>
<body>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<button id="yzm" onclick="sendyzm()" >发送验证码</button>

</body>
</html>